-
Notifications
You must be signed in to change notification settings - Fork 400
SharedWorker
refactor
#471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Decouple and re-organize `SharedWorker` code for better maintainability. perf(shared-worker): improved subscription state refresh logic Additional query parameter (removed before sending) is added for requests triggered by user and state will be updated only for these requests. refactor(logger): avoid similar timestamp in sequential lines Log entry timestamp will be altered on millisecond if multiple log entries have similar timestamp (logged in fraction of nanoseconds).
🎉 Snyk checks have passed. No issues have been found so far.✅ security/snyk check is complete. No issues have been found. (View Details) ✅ license/snyk check is complete. No issues have been found. (View Details) |
mohitpubnub
reviewed
Aug 7, 2025
@mohitpubnub sure |
…` change Handle the situation when `userId` is changed without proper state changes (unsubscribe, change, and subscribe back). fix(shared-worker): fix subscribe/heartbeat aggregation after `auth` change fix(shared-worker): fix race of conditions with backup timer Fix race of conditions caused by explicit heartbeat on `auth` change and frequency throttling logic, which prevented "backup" timer restart.
mohitpubnub
reviewed
Aug 14, 2025
src/transport/subscription-worker/components/heartbeat-requests-manager.ts
Show resolved
Hide resolved
… next subscribe request takes place only after setToken(). to avoid race condition on checking authtoken vs previous subscribe
Fixed issue when user additionally calls unsubscribe on page unload and it collides with built-in logic, which invalidates PubNub client from closed tab. fix(shared-worker): fix issue that didn't handle properly too early heartbeat Resolved the issue because of which requests that were too early received a response and still have been sent. fix(shared-worker): try to fix client timeout timer throttling Try to resolve issues with timers getting throttled in SharedWorker and actually active PubNub clients being mistakenly evicted from the state and the state reset for it.
Call 'invalidate' in the client manager only if the client removed in response to the timeout timer detected that it is inactive.
mohitpubnub
reviewed
Aug 15, 2025
Adjust the code that is called on identity (`userId`) and auth token change to modify the state only if values actually have been changed. refactor(shared-worker): change condition for stalled `ping` timer Change the condition that is used to identify whether the `offline` detection timer has been suspended by the browser or not before trying to evict "offline" PubNub clients.
mohitpubnub
approved these changes
Aug 25, 2025
src/transport/subscription-worker/components/subscribe-requests-manager.ts
Show resolved
Hide resolved
@pubnub-release-bot release |
🚀 Release successfully completed 🚀 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
priority: medium
This PR should be reviewed after all high priority PRs.
type: refactor
This PR contains refactored existing features.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fix(shared-worker): fix issue that didn't handle properly too early heartbeat
Resolved the issue because of which requests that were too early received a response and still have been sent.
refactor(shared-worker): reorganize
SharedWorker
codeDecouple and re-organize
SharedWorker
code for better maintainability.perf(shared-worker): improved subscription state refresh logic
Additional query parameter (removed before sending) is added for requests triggered by user and state will be updated only for these requests.
refactor(logger): avoid similar timestamp in sequential lines
Log entry timestamp will be altered on millisecond if multiple log entries have similar timestamp (logged in fraction of nanoseconds).
refactor(shared-worker): change condition for stalled
ping
timerChange the condition that is used to identify whether the
offline
detection timer has been suspended by the browser or not before trying to evict "offline" PubNub clients.